package com.hc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hc.domain.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("SELECT	tb_permission.`code`\n" +
            "FROM	tb_permission\n" +
            "	INNER JOIN	tb_role_permission\n" +
            "	ON tb_permission.id = tb_role_permission.permission_id\n" +
            "WHERE role_id = #{roleId}")
    List<Permission> selectPermissionByRoleId(@Param("roleId") Integer roleId);

}